﻿/// <reference path="../jquery-3.4.1.min.js" />
/// <reference path="../common.js" />

$(function () {
    if (self != top) {
        top.location.reload();
    }

    BindEvents();
});


function BindEvents() {
    $('#btnSignIn').click(requestToLogin);

    $('#uname,#userpwd').keydown(function (e) {
        if (e.keyCode == 13) {
            requestToLogin();
        }
    });
}

function requestToLogin() {
    var postData = $('#loginCard').getData('permissionToLogin');
    
    $.rajax('handler/login.ashx', postData, function (retobj) {
        if (retobj.flag == 1) {
            sysAlert.success('登录成功');
            window.location.reload();
        }
        else {
            sysAlert.Error(retobj.msg);
        }
    });
}